import { readFile } from "node:fs/promises";

import lincy from "@lincy/eslint-config";

const autoImport = JSON.parse(
    (await readFile(new URL("./.eslintrc-auto-import.json", import.meta.url))).toString()
);

const config = await lincy(
    {
        unocss: true,
        formatters: {
            css: false,
            graphql: true,
            html: true,
            markdown: true
        },
        toml: false,
        pnpm: false,
        overrides: {
            perfectionist: {}
        }
    },
    {
        languageOptions: {
            globals: {
                ...autoImport.globals
            }
        }
    },
    {
        ignores: ["**/assets", "**/static", "**/public", "**/polyfill"]
    },
    {
        rules: {
            "style/quotes": ["error", "double"], // 只保留你想要的,
            "style/comma-dangle": ["error", "never"],
            "style/semi": ["error", "always"],
            "style/brace-style": ["error", "1tbs"],
            "vue/html-indent": "off",
            "vue/html-closing-bracket-newline": "off",
            "vue/html-self-closing": "off",
            "vue/multiline-html-element-content-newline": "off",
            "style/member-delimiter-style": "off",
            "object-shorthand": "off",
            "quote-props": "off",
            "style/quote-props": "off",
            "unocss/order-attributify": "off",
            "vue/attributes-order": "off",
            "vue/block-order": "off",
            "vue/padding-line-between-blocks": "off",
            "vue/define-macros-order": "off",
            "vue/no-required-prop-with-default": "off",
            "unused-imports/no-unused-imports": "off",
            "perfectionist/sort-imports": "off",
            "antfu/top-level-function": "off",
            "node/handle-callback-err": "off",
            "no-useless-return": "off",
            "antfu/if-newline": "off",
            "vue/v-on-event-hyphenation": "off",
            "style/arrow-parens": "off"
        }
    }
);

export default config;
